<template>
    <div>
       <img src="../assets/zchcss/fengmian.jpg" alt=""  v-show="show"> 
       <div class="gg"  v-show="show" @click="showed">广告 : {{n}}</div>
     </div>
</template>

<script>
export default {
     data(){
       return {
           n:2,
           show:true
       }
 },
     methods:{
        showed(){
            this.show=false
             this.$router.push( { path : '/homes'    }  )
        }
    },
     mounted () {
   var timer = setInterval(() => {
          if(this.n>0){
            this.n--
        }else {
            this.n = "關閉"
            this.show = false
            this.$router.push( { path : '/homes'    }     )
            clearInterval(timer) 
            //跳转的页面写在此处
         

        }
}, 1200);
      }
}
</script>



<style scoped>
img {
    width: 100%;
    height: 667px;
    position: fixed;
    z-index: 11;
    left: 0px;
}

.gg {
    width: 100px;
    height: 30px;
    background: black;
    opacity: 0.3;
    color:white;
    border-radius: 30px;
    line-height: 30px;
    position: fixed;
    z-index: 12;
    top: 90px;
    right: 15px;
    text-align: center;
   }




</style>